package com.ruoyi.student.domain.vo;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.List;

/**
 * 手动排课输入DTO（前端→后端：创建课程班+关联学生）
 */
public class ManualClassInputDTO {
    // 1. 课程班基础信息（必选字段加@NotBlank/@NotNull，可选字段不加）
    @NotBlank(message = "开课班ID不能为空")
    private String trainingProgramCoursesId;

    @NotBlank(message = "课程ID不能为空")
    private String courseId; // 课程主键ID

    @NotBlank(message = "培养方案ID不能为空")
    private String trainingProgramId; // 关联的培养方案ID

    @NotNull(message = "学期不能为空")
    private Long semester; // 学期（如：1）

    @NotNull(message = "年级不能为空")
    private Long grade; // 年级（如：2025）

    @NotNull(message = "学年不能为空")
    private Long academicYear; // 学年（通常与年级一致，如：2025）

    @NotBlank(message = "班级名称不能为空")
    @Size(max = 50, message = "班级名称不能超过50个字符")
    private String className; // 班级名称（如：高等数学-2025级-1班）

    @NotNull(message = "班级最大容量不能为空")
    private Long maxCapacity; // 班级最大人数（如：50）

    private Integer isRequired = 0; // 是否必修（0：否，1：是，默认0）

    @NotBlank(message = "开课院系不能为空")
    private String department; // 开课学院（如：数学与统计学院）

    // 2. 学生关联字段（复数命名+非空校验）
    @NotEmpty(message = "学生ID列表不能为空")
    private List<String> studentIds; // 该班级的学生主键ID列表

    // ----------------- getter/setter（自动生成，注意字段名是studentIds） -----------------
    public String getTrainingProgramCoursesId() {
        return trainingProgramCoursesId;
    }

    public void setTrainingProgramCoursesId(String trainingProgramCoursesId) {
        this.trainingProgramCoursesId = trainingProgramCoursesId;
    }

    public String getCourseId() {
        return courseId;
    }

    public void setCourseId(String courseId) {
        this.courseId = courseId;
    }

    public String getTrainingProgramId() {
        return trainingProgramId;
    }

    public void setTrainingProgramId(String trainingProgramId) {
        this.trainingProgramId = trainingProgramId;
    }

    public Long getSemester() {
        return semester;
    }

    public void setSemester(Long semester) {
        this.semester = semester;
    }

    public Long getGrade() {
        return grade;
    }

    public void setGrade(Long grade) {
        this.grade = grade;
    }

    public Long getAcademicYear() {
        return academicYear;
    }

    public void setAcademicYear(Long academicYear) {
        this.academicYear = academicYear;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public Long getMaxCapacity() {
        return maxCapacity;
    }

    public void setMaxCapacity(Long maxCapacity) {
        this.maxCapacity = maxCapacity;
    }

    public Integer getIsRequired() {
        return isRequired;
    }

    public void setIsRequired(Integer isRequired) {
        this.isRequired = isRequired;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public List<String> getStudentIds() {
        return studentIds;
    }

    public void setStudentIds(List<String> studentIds) {
        this.studentIds = studentIds;
    }

    // ----------------- 修正后的toString()（无语法错误，日志打印正常） -----------------
    @Override
    public String toString() {
        return "ManualClassInputDTO{" +
                "trainingProgramCoursesId='" + trainingProgramCoursesId + '\'' +
                ", courseId='" + courseId + '\'' +
                ", trainingProgramId='" + trainingProgramId + '\'' +
                ", semester=" + semester +
                ", grade=" + grade +
                ", academicYear=" + academicYear +
                ", className='" + className + '\'' +
                ", maxCapacity=" + maxCapacity +
                ", isRequired=" + isRequired +
                ", department='" + department + '\'' +
                ", studentIds=" + studentIds +
                '}';
    }
}